﻿using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Domains.hq;
using RearLivestock.Common.Dtos;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.Enterprisess;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.PigBaby;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.PigBabyss;

namespace RearLivestock.RBAC.Api.Controllers.hq
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PigController : ControllerBase
    {
        private readonly IMediator imediator;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="imediaManager"></param>
        public PigController(IMediator imediator)
        {
            this.imediator = imediator;
        }
        /// <summary>
        /// 后裔添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> addPigBabys(AddPigCommand command)
        {
            return await imediator.Send(command);
        }

        /// <summary>
        /// 初期显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result<PageResultDto<PigBayassesDto>>> ShowPigBabys(ShowPigCommand request)
        {
            return await imediator.Send(request);

        }

    }
}
